package com.forum.module.blog.dal.mysql.favorite;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.forum.framework.common.pojo.PageResult;
import com.forum.framework.mybatis.core.mapper.BaseMapperX;
import com.forum.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.forum.module.blog.controller.favorite.vo.FavoritePageReqVO;
import com.forum.module.blog.dal.dataobject.favorite.FavoriteDO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface FavoriteMapper extends BaseMapperX<FavoriteDO> {
    default PageResult<FavoriteDO> selectPage(FavoritePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FavoriteDO>()
                .eqIfPresent(FavoriteDO::getUserId, reqVO.getUserId()));
    }
}
